
#include "3dUtil.h"

int Write_Error(char *string, ...)
{
	// this function prints out the error string to the error file

	//char buffer[1024]; // working buffer

	//va_list arglist; // variable argument list

	//// make sure both the error file and string are valid
	//if (!string || !fp_error)
	//	return(0);

	//// print out the string using the variable number of arguments on stack
	//va_start(arglist,string);
	//vsprintf(buffer,string,arglist);
	//va_end(arglist);

	//// write string to file
	//fprintf(fp_error,buffer);

	//// flush buffer incase the system bails
	//fflush(fp_error);

	// return success
	return 0;
} // end Write_Error


inline void Mem_Set_WORD(void *dest, USHORT data, int count)
{
// this function fills or sets unsigned 16-bit aligned memory
// count is number of words

//Write_Error("{");

_asm 
    { 
    mov edi, dest   ; edi points to destination memory
    mov ecx, count  ; number of 16-bit words to move
    mov ax,  data   ; 16-bit data
    rep stosw       ; move data
    } // end asm

//Write_Error("}");

} // end Mem_Set_WORD

///////////////////////////////////////////////////////////

inline void Mem_Set_QUAD(void *dest, UINT data, int count)
{
// this function fills or sets unsigned 32-bit aligned memory
// count is number of quads

_asm 
    { 
    mov edi, dest   ; edi points to destination memory
    mov ecx, count  ; number of 32-bit words to move
    mov eax, data   ; 32-bit data
    rep stosd       ; move data
    } // end asm

} // end Mem_Set_QUAD
